<template>
  <!-- 特征权重分析 -->
  <a-card :bordered="false">
    <div class="table-operator">
       <div class="table-page-search-wrapper">
        <a-form layout="inline">
          <a-row :gutter="12">
            <a-col :md="6" :sm="12">
              <a-form-item label="数据集">
                <a-select placeholder="请选择" default-value="数据集一">
                  <a-select-option value="数据集一">数据集一</a-select-option>
                  <a-select-option value="数据集二">数据集二</a-select-option>
                  <a-select-option value="数据集三">数据集三</a-select-option>
                </a-select>
              </a-form-item>
            </a-col> 
            <a-col :md="4" :sm="12">
              <span class="table-page-search-submitButtons"
                :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
                <a-button type="primary" @click="handleAnalyse" :loading="confirmLoading">开始分析</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form> 
       </div>
    </div>
    <a-spin :spinning="confirmLoading">
      <div v-if="isShowData">
        <a-row :gutter="[24, 8]">
          <a-col :span="8">
            <a-card>
              <a-table
                ref="table"
                size="middle"
                bordered
                rowKey="id"
                class="j-table-force-nowrap"
                :scroll="{ x: true }"
                :columns="columns"
                :dataSource="dataSource"
                :pagination="ipagination"
                :loading="loading"
                @change="handleTableChange"
              >
              </a-table>
            </a-card>
          </a-col>
          <a-col :span="16">
            <a-card>
              <pie title="" :height="height" :dataSource="pieDataSource" />
            </a-card>
          </a-col>
        </a-row>
      </div>
      <div v-else> 
      </div>
    </a-spin>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import '@/assets/less/TableExpand.less'
import splitPane from 'vue-splitpane'
import Pie from '@/components/chart/Pie'
export default {
  name: 'DataSetBuild',
  mixins: [JeecgListMixin],
  components: {
    splitPane,
    Pie,
  },
  data() {
    return {
      description: '特征值权重分析',
      isShowData: false,
      confirmLoading: false,
      height: 567,
      pieDataSource: [
        { item: '电压', count: 40 },
        { item: '电流', count: 21 },
        { item: '电阻', count: 17 },
        { item: '滤波电阻', count: 13 },
        { item: '平滑电阻', count: 9 },
      ],
      /* 排序参数 */
      isorter: {
        column: 'createTime',
        order: 'asc',
      },
      ipagination: {
        simple: true,
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: false,
        showSizeChanger: false,
        total: 0,
      },
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '特征值',
          align: 'center',
          width: 180,
          dataIndex: 'propName',
        },
        {
          title: '权重',
          align: 'center',
          dataIndex: '',
          customRender: function (t, r, index) {
            return Math.floor(Math.random() * 10)
          },
        },
      ],
      url: {
        list: '/dataProperty/dataProperty/list',
        delete: '/userFormula/userFormula/delete',
        deleteBatch: '/userFormula/userFormula/deleteBatch',
        exportXlsUrl: '/userFormula/userFormula/exportXls',
        importExcelUrl: 'userFormula/userFormula/importExcel',
      },
      dictOptions: {},
      superFieldList: [],
    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    initDictConfig() {},
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'string', value: 'formulaName', text: '公式名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'formulaContent', text: '内容', dictCode: '' })
      fieldList.push({ type: 'date', value: 'modifyDate', text: '修改日期' })
      fieldList.push({ type: 'string', value: 'remark', text: '备注', dictCode: '' })
      fieldList.push({ type: 'int', value: 'seqNo', text: '序号，用于公式排序', dictCode: '' })
      fieldList.push({ type: 'string', value: 'userId', text: '创建人', dictCode: '' })
      this.superFieldList = fieldList
    },
    handleAnalyse() {
      var that = this
      this.confirmLoading = true
      setTimeout(() => {
        that.isShowData = true
        that.confirmLoading =false
      }, 2000)
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>